package com.qiaofang.collectmanage.task;
import com.github.ltsopensource.core.domain.Action;
import com.github.ltsopensource.core.logger.Logger;
import com.github.ltsopensource.core.logger.LoggerFactory;
import com.github.ltsopensource.tasktracker.Result;
import com.github.ltsopensource.tasktracker.runner.JobContext;
import com.github.ltsopensource.tasktracker.runner.JobRunner;
import com.qiaofang.collectmanage.service.CollectQualityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

@Component
public class CollectQualityDataRunner implements JobRunner{

    private final Logger logger = LoggerFactory.getLogger(CollectQualityDataRunner.class);

    @Autowired
    CollectQualityService collectQualityService;

    @Override
    public Result run(JobContext jobContext) throws Throwable {
        try {
            logger.info("now time:" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
            collectQualityService.timeStatisticsEntry();
        }catch(Exception e){
            e.printStackTrace();
        }
        return new Result(Action.EXECUTE_SUCCESS, this.getClass() + " SUCCESS");
    }

}
